<!-- 头部组件 src/components/BkHeader.vue -->
<script setup lang="ts">
import { useHomeStore } from "@/stores/homeStore";

//获取首页实例
const homeStore = useHomeStore();
const { getBanners } = homeStore;
// 发送请求获取轮播图状态
getBanners();
</script>
<template>
  <div>
    <div class="title">
      <h1>染柒</h1>
      <p>关于染柒的个人博客</p>
    </div>
    <BkCarousel
      :carousels="homeStore.banners.result"
      v-if="homeStore.banners.status === 'success'"
    >
      <template
        v-for="(item, index) in homeStore.banners.result"
        v-slot:[`default-${index}`]
      >
        <img :src="item.url" alt="" />
      </template>
    </BkCarousel>
  </div>
</template>

<style scoped lang="scss">
.title {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  color: var(--el-bg-color-overlay);
  h1 {
    font-style: 30px;
    font-weight: 400;
    text-align: center;
    margin-bottom: 10px;
  }
  p {
    font-style: 18px;
    text-align: center;
  }
}
img {
  width: 100%;
  height: 100%;
}
</style>
